﻿
IF (EXISTS(SELECT id from sysobjects where id=object_id('usp_voterHaveVoted')))
	DROP PROCEDURE [dbo].[usp_voterHaveVoted]
GO

set ANSI_NULLS ON
set QUOTED_IDENTIFIER ON
go

Create PROCEDURE [dbo].[usp_voterHaveVoted]
@VoterId as varchar(50),
@ElectionId as nvarchar(50)
AS
SET NOCOUNT ON;
declare @Count as int
declare @HaveVoted as bit
select @Count = count(0) from TblVoterVote where VoterId=@VoterId;

if (@Count > 0)
	set @HaveVoted=1
else
	set @HaveVoted=0
	
select  @HaveVoted as HaveVoted, * from TblVoter where 
VoterId = @VoterId

